﻿@page
@model IndexModel
@{
    ViewBag.Title = "敏感词汇";
    ViewBag.Current = "sys.SensitiveWords";
}

<div class="card data-list">
    <div class="card-header toolbar">
        <form method="get">
            <gt:search placeholder="敏感词" asp-for="Query.Word"></gt:search>
        </form>
        <div class="actions" .permission="@Permissions.EditSensitive">
            <gt:action-group>
                <gt:action typeof="Add" asp-page="./Edit"></gt:action>
                <gt:action typeof="Delete" confirm="你确定要删除所选择的敏感词吗？" asp-page-handler="Delete"></gt:action>
                <gt:action typeof="Upload" asp-page-handler="Upload">导入</gt:action>
            </gt:action-group>
        </div>
    </div>

    <div class="card-body">
        <table class="table table-hover" .warning="Model.Words" .warning-text="还没有添加任何字典实例！">
            <thead>
                <tr>
                    <th class="checkbox"><gt:checkall></gt:checkall></th>
                    <th>敏感词</th>
                    <th>添加时间</th>
                    <th class="text-center" .permission="@Permissions.EditSensitive">操作</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var word in Model.Words)
                {
                    <tr class="data-item">
                        <td class="checkbox"><gt:checkbox value="@word.Id"></gt:checkbox></td>
                        <td>
                            @word.Word
                        </td>
                        <td>@word.CreatedDate.ToString("yyyy-MM-dd HH:mm:ss")</td>
                        <td .permission="@Permissions.EditSensitive">
                            <gt:action-dropdownmenu>
                                <gt:action typeof="Edit" asp-page="./Edit" asp-route-id="@word.Id"></gt:action>
                                <gt:action typeof="Delete" asp-route-id="@word.Id" confirm="你确定要删除“@word.Word”吗？" asp-page-handler="Delete"></gt:action>
                            </gt:action-dropdownmenu>
                        </td>
                    </tr>
                }
            </tbody>
        </table>
        <gt:page asp-route-word="@Model.Query.Word" data="@Model.Words"></gt:page>
    </div>
</div>